package rnd;

import utils.MyUtils;

public class PermutationsCreator {

	private static String[] productsArray = new String[] { "MC", "VRP", "DL" };
	private static String[] statusesArray = new String[] { "PAID", "PENDING", "EXPIRED", "NOTHING" };

	public static void main(String[] args) {
		newWay();
	}

	private static void newWay() {
		int cantidad = (int) Math.pow(statusesArray.length, productsArray.length);

		StringBuilder sb = new StringBuilder().append('\t');
		for (String product : productsArray) {
			sb.append(product).append('\t');
		}
		sb.append(MyUtils.EOL);

		for (int i = 0; i < cantidad; i++) {
			sb.append(i + 1).append('\t');

			for (int j = 0; j < productsArray.length; j++) {
				int index = getDigit(i, statusesArray.length, productsArray.length - 1 - j);

				sb.append(statusesArray[index]).append('\t');
			}

			sb.append(MyUtils.EOL);
		}

		System.out.println(sb);
	}
	public static int getDigit(int number, int base, int column) {
		return (int) ((number / Math.pow(base, column)) % base);
	}

}
